Skip to content

Custom timeout for delayed event restarts #4921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

toger5
Copy link
Contributor

@toger5 toger5 commented Jul 15, 2025

(alternative to: #4896)

This PR introduces a new setting delayedEventRestartLocalTimeoutMS.

This setting is used in the context of MatrixRTC. We need to restart the dealyed events to make sure
the HomeServer is sending the delayed rtc leave event. In bad network environments we might end up
waiting for too long for the event to arrive and we will not send another restart event until the local timeout is reached.

In those scenarios chances for success are higher if we use a lower local timeout to increase the tries we do instead of waiting
for responses on requests which are stuck.

It also sets the default value for it to: 2300 which works well.

The reason why we make this a global configuration instead of sth we pass through via the requestOptions as it is done in: #4896 is because of how Element Call is implemented.

In SPA mode we can control where we send POST /_matrix/client/v1/delayed_events/{delay_id}. But in widget mode we cannot configure the exact call to the enpoint. The widget driver will just use the raw function.

Delayed event restarts in general are a very cheap server operation. So a smaller timeout in every case seems appropriate.

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • Sign-off given on the changes (see CONTRIBUTING.md).

@toger5 toger5 marked this pull request as ready for review July 15, 2025 15:22
@toger5 toger5 requested a review from a team as a code owner July 15, 2025 15:22
@toger5 toger5 requested review from florianduros and MidhunSureshR and removed request for a team July 15, 2025 15:22
@toger5 toger5 requested a review from a team as a code owner July 17, 2025 14:00
@toger5 toger5 requested review from AndrewFerr and removed request for a team July 17, 2025 14:00
@toger5 toger5 force-pushed the toger5/custom-timeout-for-delayed-restart branch from d056570 to a4310d8 Compare July 17, 2025 14:00
@toger5 toger5 force-pushed the toger5/custom-timeout-for-delayed-restart branch from a7abdf6 to fae4ca4 Compare July 17, 2025 15:30
@toger5 toger5 changed the base branch from fkwp/matrixrtc/delayed_event_reset_timeout to develop July 18, 2025 13:32
@toger5 toger5 force-pushed the toger5/custom-timeout-for-delayed-restart branch from fae4ca4 to 6e5ca15 Compare July 18, 2025 13:33
@toger5 toger5 requested review from a team as code owners July 18, 2025 13:33
@toger5 toger5 requested review from andybalaam and uhoreg July 18, 2025 13:33
Copy link
Member

@robintown robintown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where should I be looking to find the default of 2300 ms?

And hmm, I'm not quite finding this solution elegant. I do like Florian's solution to cover the Element Call SPA case. For the widget case, have we considered setting 2300 ms as an opinionated default for all widget API calls to this endpoint in Element Web?

@toger5
Copy link
Contributor Author

toger5 commented Jul 18, 2025

Where should I be looking to find the default of 2300 ms

It would be part of EC. The PR does not yet exist but would be a one line PR to add the config param.

@toger5
Copy link
Contributor Author

toger5 commented Jul 18, 2025

For the widget case, have we considered setting 2300 ms as an opinionated default for all widget API calls to this endpoint in Element Web?

This has been done in the rust-sdk. https://github.com/matrix-org/matrix-rust-sdk/pull/5413/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants